package com.itic.appbase.framework.xcx.type;
/**
 * 商品状态
 * @author enne
 *
 */
public enum GoodState {
	
	down("0","下架"),up("1","上架");

	private String state;
	
	private String name;
	
	GoodState(String state, String name) {
		this.state = state;
		this.name = name;
	}
	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public static GoodState getGoodState(String state) {
		GoodState goodState = null;
		switch (state) {
		case "0":
			goodState = GoodState.down;
			break;
		case "1":
			goodState = GoodState.up;
			break;
		}
		return goodState;
	}
	
	/**
	 * 判断店铺是否开店状态
	 * @param state
	 * @return
	 */
	public static boolean isGoodDown(String state) {
		GoodState goodState =  getGoodState(state);
		if(goodState!=null && goodState.getState().equals(goodState.down.getState()))
			return true;
		else
			return false;
	}
	
}
